|
|
 |
|
|
|
|
Else
ymin = Y2
ymax = Y1
End If
End Sub
' Return a serialization string for the object. Public Property Get TwoDObject_Serialization() As String
Dim txt As String
txt = txt & "X1(" & Format$(X1) & ")"
txt = txt & "Y1(" & Format$(Y1) & ")"
txt = txt & "X2(" & Format$(X2) & ")"
txt = txt & "Y2(" & Format$(Y2) & ")"
TwoDObject_Serialization = "TwoDLine(" & txt & ")"
End Property
' Initialize the object using a serialization string.
' The serialization does not include the
' "TwoDLine(...)" part. Private Property Let TwoDObject_Serialization( _
ByVal RHS As String)
Dim token_name As String
Dim token_value As String
' Read tokens until there are no more. Do While Len(RHS) > 0 ' Read a token. GetNamedToken RHS, token_name, token_value
Select Case token_name
Case "X1"
X1 = CSng(token_value)
Case "Y1"
Y1 = CSng(token_value)
Case "X2"
X2 = CSng(token_value)
Case "Y2"
Y2 = CSng(token_value)
End Select
Loop
End Property |
|
|
|
|
|
|
|
|
The TwoDObject_Serialization property let procedure uses the GetNamedToken subroutine to break a serialization string into pieces. Each token is of the form TokenName(TokenValue). Subroutine GetNamedToken searches the string for the first opening parenthesis to tell where the token name ends. It then searches for the next unmatched closing parenthesis to see where the token value ends. |
|
|
|
 |
|
|
|
|
' Return a named token from the string txt.
' Tokens have the form TokenName(TokenValue). Public Sub GetNamedToken(ByRef txt As String, _ |
|
|
|
|
|